package com.morgan.test;

import org.apache.commons.lang.StringUtils;

public class CTSubString {
    
    public static void main (String[] args) {
        
        String name = "-^Morgan";
        System.out.println(name.substring(2));
        
        
        System.out.println("sdfdsfds(fdsfds".split("\\(")[0]);
        
        
        
        String mm = "sfsdsdfSDDSSAAAFD";
        
        System.out.println(mm.toLowerCase());
        System.out.println(mm);
        

        System.out.println("Morganresr".contains("morgan"));
        
        System.out.println(StringUtils.isBlank("    "));
        
        
        String className1 = "testMorgansfdsfsdfdsfTest";
        String className2 = "testMorgansfdsfsdfdsf";
        String className3 = "MorgansfdsfsdfdsfTest";
        
        System.out.println(removeTest(className1));
        System.out.println(removeTest(className2));
        System.out.println(removeTest(className3));
    }
    
    private static String removeTest(String className) {
 
        if (className.length() >= 4) {
            String prefix = className.substring(0, 4);
            String suffix = className.substring(className.length() - 4, className.length());
            
            if (prefix.equalsIgnoreCase("test")) {
                className = className.substring(4, className.length());
            }
            
            if (suffix.equalsIgnoreCase("test")) {
                className = className.substring(0, className.length() - 4);
            }

        } else {
            System.out.println("ClassName: " + className + "It's wrong!!!");
        }
        
        return className;

    }
}
